﻿//   计算两个数据的最大值
#include <iostream>
using namespace std;

void swap(int* x, int* y) //函数定义，形参为指针
{
	int temp;
	temp = *x;
	*x = *y;
	*y = temp;
}

void swap(int& x, int& y)
{
	int t = x;
	x = y;
	y = t;
}

int main(void)
{
	int a = 5, b = 10;
	cout << "Before Swap a=" << a << ",b=" << b << endl;
	swap(&a, &b); //传地址调用
	cout << "After Swap a=" << a << ",b=" << b << endl;

	// DONE 再次交换
	swap(a, b); //传地址调用
	cout << "After Swap a=" << a << ",b=" << b << endl;

	cin.ignore();
	return 0;
}   /*end main*/
